package xxl.robotlegs.extensions.mediatormap.impl 
{
	import xxl.robotlegs.extensions.matching.api.ITypeFilter;
	import xxl.robotlegs.extensions.mediatormap.api.IMediatorConfigurator;
	import xxl.robotlegs.extensions.mediatormap.api.IMediatorMapping;
	/**
	 * ...
	 * @author XXL
	 */
	public class MediatorMapping implements IMediatorMapping, IMediatorConfigurator
	{
		private var _matcher:ITypeFilter;
		private var _mediatorClass:Class;
		private var _guards:Array = [];
		private var _hooks:Array = [];
		private var _autoRemoveEnabled:Boolean = true;
		
		public function MediatorMapping(matcher:ITypeFilter, mediatorClass:Class) 
		{
			_matcher = matcher;
			_mediatorClass = mediatorClass;
		}
		
		/* INTERFACE xxl.robotlegs.extensions.mediatormap.api.IMediatorMapping */
		
		public function get matcher():ITypeFilter 
		{
			return _matcher;
		}
		
		public function get mediatorClass():Class 
		{
			return _mediatorClass;
		}
		
		public function get guards():Array 
		{
			return _guards;
		}
		
		public function get hooks():Array 
		{
			return _hooks;
		}
		
		public function get autoRemoveEnabled():Boolean 
		{
			return _autoRemoveEnabled;
		}
		
		/* INTERFACE xxl.robotlegs.extensions.mediatormap.api.IMediatorConfigurator */
		
		public function withGuards(...guards):IMediatorConfigurator 
		{
			_guards = _guards.concat(guards);
			return this;
		}
		
		public function withHooks(...hooks):IMediatorConfigurator 
		{
			_hooks = _hooks.concat(hooks);
			return this;
		}
		
		public function autoRemove(value:Boolean = true):IMediatorConfigurator 
		{
			_autoRemoveEnabled = value;
			return this;
		}
		
	}

}